package de.htw.ejb.model;

import de.htw.ejb.model.BestellpositionSchluessel;

import java.io.Serializable;

import javax.persistence.Embeddable;

/**
 * Schluesselklasse fuer Bestellposition.
 * 
 * @author Thomas Schoenfeld
 * @version 20130313-01
 */
@Embeddable
public class BestellpositionSchluessel implements Serializable
{
	private static final long	serialVersionUID	= 1L;
	private int								bestellnummer;
	private int								position;
	
	public int getBestellnummer()
	{
		return bestellnummer;
	}
	
	public void setBestellnummer( int bestellnummer )
	{
		this.bestellnummer = bestellnummer;
	}
	
	public int getPosition()
	{
		return position;
	}
	
	public void setPosition( int position )
	{
		this.position = position;
	}
	
	@Override
	public String toString()
	{
		return "BestellpositionSchluessel [bestellnummer=" + bestellnummer
				+ ", position=" + position + "]";
	}
	
	@Override
	public int hashCode()
	{
		final int prime = 31;
		int result = 1;
		result = prime * result + bestellnummer;
		result = prime * result + position;
		return result;
	}
	
	@Override
	public boolean equals( Object obj )
	{
		if ( this == obj )
			return true;
		if ( obj == null )
			return false;
		if ( getClass() != obj.getClass() )
			return false;
		BestellpositionSchluessel other = ( BestellpositionSchluessel ) obj;
		if ( bestellnummer != other.bestellnummer )
			return false;
		if ( position != other.position )
			return false;
		return true;
	}
}